// createStore 创建仓库实例的函数
import { createStore } from 'vuex'
import createPersistedstate from 'vuex-persistedstate'
import user from './modules/user'
import cart from './modules/cart'
import category from './modules/category'

const store = createStore({

  // 模块化
  modules: {
    user,
    category,
    cart
  },
  // 使用插件来进行持久化--配置项
  plugins: [
    createPersistedstate({
      key: 'erabbit-client-pc-store',
      paths: ['user', 'cart']
    })
  ]
})

export default store
